--  delete from cv_resume
-- select * from cv_resume
-- INSERT INTO cv_resume
SELECT 
case len(convert(varchar(10),r.id))
	when 7 then '00000000-0000-0000-0000-00000' + convert(varchar(10),r.id) 
	when 6 then '00000000-0000-0000-0000-000000' + convert(varchar(10),r.id) 
    when 5 then '00000000-0000-0000-0000-0000000' + convert(varchar(10),r.id) 
    when 4 then '00000000-0000-0000-0000-00000000' + convert(varchar(10),r.id) 
    when 3 then '00000000-0000-0000-0000-000000000' + convert(varchar(10),r.id) 
    when 2 then '00000000-0000-0000-0000-0000000000' + convert(varchar(10),r.id) 
    when 1 then '00000000-0000-0000-0000-00000000000'+ convert(varchar(10),r.id) 
    end As Id,resumename AS [ResumeName],convert(varchar(10),r.id) AS [ReferenceNumber],isnull(firstnamecn,'') AS [FullName],isnull(sex,109104) AS [Gender],birthday AS [BirthDate],pcnumber AS [IDCard],NULL AS Avatar,contacttel AS [Tel],contactmobile AS [Mobile],contactmail AS [Email],NULL AS [PersonalSite],birthprovince AS [Province1],BirthCity AS [City1],NULL AS [District1],LiveProvince AS [Province2],LiveCity AS [City2],NULL AS [District2],LiveAddress AS [Street2],LivePostcode AS [PostalCode],NearStation AS [BusLines],1 AS [PrivacyStatus],education AS [EducationLevel],workyear AS [YearsOfExperience],NULL AS [CareerLevel],Language1 AS [Language1],Level1 AS [Level1],Language2 AS [Language2],Level2 AS [Level2],0 AS [IsGraduates],selfdiscription AS [PersonalStatement],left(g.wantwrokAreaCity,7) AS [DesiredLoaction],g.wantjobtype AS [DesiredJobType],CurrentYearSalary AS [CurrentRevenue],g.salarylevel AS [DesiredSalary],left(g.wantjobsndclass,9) AS [DesiredOccupation],left(g.wantindustry,7)  AS [DesiredIndustry],left(g.companychar,6) AS [DesiredCompanyType],NULL AS [CanStart],NULL AS [StartOn],NULL AS [ResumeTag],0 AS [IsShieldedInsurance],IntegrityFlag AS [Integrity],readtimes AS [Views],NULL AS [Notes],r.CreatedDate AS [DateCreated],r.Updateddate AS [LastUpdated],'00000000-0000-0000-0000-00000' + convert(varchar(7),Userid) AS  [JobseekerId],NULL AS [Revision]from srv_lnk.nchr2008.dbo.personResume r left join srv_lnk.nchr2008.dbo.ResumeJob g
on r.id = g.resumeid
where userid in (select right(id,7) from cat_jobseeker)

--SELECT TOP 5 * FROM srv_lnk.nchr2008.dbo.personResume
